package com.cndw.kungfu.dao;


import java.util.List;
import java.util.Map;

import com.cndw.dao.jade.annotation.DAO;
import com.cndw.dao.jade.annotation.KeyColumnOfMap;
import com.cndw.dao.jade.annotation.SQL;
import com.cndw.dao.jade.annotation.SQLParam;
import com.cndw.kungfu.domain.GoodsExt;
import com.cndw.kungfu.domain.GoodsMode;
import com.cndw.kungfu.domain.GoodsSuite;
import com.cndw.kungfu.domain.GoodsType;

@DAO
public interface GoodsModeDao {
	
	public static final String TABLE = " kfsys_goods_mode ";
	
	public static final String FIELDS = " goodsId,name,deputyName,goodTypeId,vocationId,maxStack,icon," +
			"playerLevel,classId,color,gold,vipScore,asset,npcRecover,openOnShop,paytype,buyEnable,saleEnable,useEnable,giftEnable,bindType," +
			"orderId,appId,valueA,valueB,subPops,coolingTime," +
			"goodDesc,goodEffect,power,physical,agile,wit,speed,append,buyLimit";
	
	
	public static final String EXT_TABLE = "kfsys_goods_ext";
	public static final String EXT_FIELDS = "goodsId,level,hp,mp,attack,defense";
	
	public static final String TYPE_TABLE = "kfsys_goods_type";
	public static final String TYPE_FIELDS = "goodTypeId,typeName,rootId";
	
	public static final String SUITE_TABLE = "kfsys_goods_suite";
	public static final String SUITE_FIELDS = "id,name,properties";
	
	/**
	 * 获取一个系统道具对象
	 * @param id
	 * @return
	 */
	@SQL("select "+FIELDS+" from "+TABLE+" where goodsId=:goodsId limit 1 ")
	public GoodsMode getByGoodsId(@SQLParam("goodsId") int goodsId);
	
	/**
	 * 一次性获取全部道具,有点bt
	 * @return
	 */
	@SQL("select "+FIELDS+" from "+TABLE+" order by orderId desc,goodsId asc ")
	public List<GoodsMode> getAllGoods();
	
	@KeyColumnOfMap("level")
	@SQL("select "+EXT_FIELDS+" from  "+EXT_TABLE+" where goodsId=:id ")
	public Map<Integer,GoodsExt> getGoodsExtByGoodsId(@SQLParam("id") int goodsId);
	
	
	@SQL("select "+EXT_FIELDS+" from  "+EXT_TABLE+" order by goodsId asc,level asc ")
	public List<GoodsExt> getGoodsExts();
	
	@SQL("select "+TYPE_FIELDS+" from "+TYPE_TABLE+" ")
	public List<GoodsType> getGoodsType();
	
	
	/**
	 * 获取装备套装
	 * 
	 * @return
	 */
	@SQL("select "+SUITE_FIELDS+" from " + SUITE_TABLE)
	public List<GoodsSuite> getAllGoodsSuite();
	
	
	
	
	
}
